package com.starsoft.quant.bean;

import java.util.List;

import com.starsoft.frame.base.bean.BaseAcount;
import com.starsoft.frame.base.bean.BaseUser;
import com.starsoft.trade.bean.TradeAcount;

public class ModelContext {

	private BaseUser user;
	private BaseAcount acount;
	private TradeAcount tradeAcount;
	private QuantAcount quantAcount;
	private QuantModel model;
	private List<QuantModelParam> modelParamList;

	public BaseUser getUser() {
		return user;
	}

	public void setUser(BaseUser user) {
		this.user = user;
	}

	public BaseAcount getAcount() {
		return acount;
	}

	public void setAcount(BaseAcount acount) {
		this.acount = acount;
	}

	public TradeAcount getTradeAcount() {
		return tradeAcount;
	}

	public void setTradeAcount(TradeAcount tradeAcount) {
		this.tradeAcount = tradeAcount;
	}

	public QuantAcount getQuantAcount() {
		return quantAcount;
	}

	public void setQuantAcount(QuantAcount quantAcount) {
		this.quantAcount = quantAcount;
	}

	public QuantModel getModel() {
		return model;
	}

	public void setModel(QuantModel model) {
		this.model = model;
	}

	public List<QuantModelParam> getModelParamList() {
		return modelParamList;
	}

	public void setModelParamList(List<QuantModelParam> modelParamList) {
		this.modelParamList = modelParamList;
	}

	public String getModelParam(String paramCode){
		for(QuantModelParam modelParam: modelParamList){
			if(modelParam.getParamCode().equalsIgnoreCase(paramCode)){
				return modelParam.getValue();
			}
		}
		throw new RuntimeException("No param:"+paramCode);
	}
	
	public Integer getAcountId() {
		return acount.getAcountId();
	}

	public boolean getTradeAuto() {
		return Boolean.TRUE.equals(quantAcount.getTradeAuto());
	}
}
